@Observed
export class GoodsItem {
  name: string

  price: number

  num: number

  select: boolean

  constructor(name: string, price: number, num = 1, select = false) {
    this.name = name
    this.price = price
    this.num = num
    this.select = select
  }

  /**
   * 更新数量
   */
  updateNum(actionType: number) {

    if (this.num + actionType === 0) {
      return
    }

    this.num += actionType
  }

  singleSelect() {
    this.select = !this.select
  }
}